package com.lry.util.requestcore;

import com.alibaba.fastjson.JSONArray;
import com.xxl.job.executor.requestcore.domain.request.GRequest;
import java.util.Map;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * @author ALI
 * @since 2023/5/16
 */
public class DefaultGRequestDealClient extends GRequestDealClient {

    private final JdbcTemplate jdbcTemplate;

    public DefaultGRequestDealClient(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }

    @Override
    protected void postProcessorAfterComplete(Map<String, String> headers) {

    }

    @Override
    protected JSONArray getSaveList(GRequest request, String body) {
        return MyHttpUtil.getArrayObject(body, request.getResponse().getDataFieldName());
    }
}
